﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace KingSite.Shop.Core.Mvc {
    public class ShopViewEngine : WebFormViewEngine {
        public string ThemeName { get; set; }

        public ShopViewEngine()
            : this("Default") {
        }

        public ShopViewEngine(string Theme) {
            ThemeName = Theme;
            MasterLocationFormats = new[]{
                string.Format("~/Theme/{0}/{{1}}/{{0}}.master", ThemeName),
                string.Format("~/Theme/{0}/shared/{{0}}.master", ThemeName)
            };

            ViewLocationFormats = new[]{
                string.Format("~/Theme/{0}/{{1}}/{{0}}.aspx", ThemeName),
                string.Format("~/Theme/{0}/{{1}}/{{0}}.ascx", ThemeName),
                string.Format("~/Theme/{0}/shared/{{0}}.aspx", ThemeName),
                string.Format("~/Theme/{0}/shared/{{0}}.ascx", ThemeName)
            };

            PartialViewLocationFormats = ViewLocationFormats;
        }
    }
}
